/**
 * Copyright (c) 2018-2023, zening (316279828@qq.com).
 * <p>
 * Any unauthorised copying, selling, transferring, distributing, transmitting, renting,
 * or modifying of the Software is considered an infringement.
 */
package com.baomibing.authority.util;

import com.baomibing.tool.util.Md5Util;
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
import org.joda.time.DateTime;


public class JasyptUtil {

	public static String dencryptSuper(String v) {
		PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
		SimpleStringPBEConfig config = new SimpleStringPBEConfig();
		String md5 = "c6698df3423c04e50dd8f563c273e4e0";// fuckPwd
		String passMd5 = md5 + Md5Util.md5(Md5Util.md5(new DateTime().toString("yyyyMMdd")));
//	  config.setPassword("c6698df3423c04e50dd8f563c273e4e0");//fuckPwd
		config.setPassword(passMd5);
		config.setAlgorithm("PBEWITHHMACSHA512ANDAES_256");
		config.setKeyObtentionIterations("1000");
		config.setPoolSize("1");
		config.setProviderName("SunJCE");
		config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
		config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator");
		config.setStringOutputType("base64");
		encryptor.setConfig(config);
		String spasswd = encryptor.decrypt(v);
		return spasswd;
	}

}
